Source for file DeleteFile.php

Documentation is available at DeleteFile.php

  1. <?php /*
  2.  * FCKeditor - The text editor for internet
  3.  * Copyright (C) 2003-2005 Frederico Caldeira Knabben
  4.  * 
  5.  * Licensed under the terms of the GNU Lesser General Public License:
  6.  *         http://www.opensource.org/licenses/lgpl-license.php
  7.  * 
  8.  * For further information visit:
  9.  *         http://www.fckeditor.net/
  10.  * 
  11.  * File Name: DeleteFile.php
  12.  *     Implements the DeleteFile command to delete a file
  13.  *     in the current directory. Output is in XML.
  14.  * 
  15.  * File Authors:
  16.  *         Grant French (grant@mcpuk.net)
  17.  */
  18. class DeleteFile {
  19.     var $fckphp_config;
  20.     var $type;
  21.     var $cwd;
  22.     var $actual_cwd;
  23.     var $newfolder;
  24.     
  25.     function DeleteFile($fckphp_config,$type,$cwd{
  26.         $this->fckphp_config=$fckphp_config;
  27.         $this->type=$type;
  28.         $this->raw_cwd=$cwd;
  29.         $this->actual_cwd=str_replace("//","/",($this->fckphp_config['UserFilesPath']."/$type/".$this->raw_cwd));
  30.         $this->real_cwd=str_replace("//","/",($this->fckphp_config['basedir']."/".$this->actual_cwd));
  31.         $this->filename=str_replace(array("..","/"),"",$_GET['FileName']);
  32.     }
  33.     
  34.     function run({
  35.         $result1=false;
  36.         $result2=true;
  37.         
  38.         $thumb=$this->real_cwd.'/.thumb_'.$this->filename;
  39.         $result1=unlink($this->real_cwd.'/'.$this->filename);
  40.         if (file_exists($thumb)) $result2=unlink($thumb);
  41.         
  42.         header ("content-type: text/xml");
  43.         echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
  44.         ?>
  45. <Connector command="DeleteFile" resourceType="<?php echo $this->type?>">
  46.     <CurrentFolder path="<?php echo $this->raw_cwd?>" url="<?php echo $this->actual_cwd?>" />
  47.     <?php
  48.         if ($result1&&$result2{
  49.             $err_no=0;
  50.         else {
  51.             $err_no=302;
  52.         }
  53.         
  54.     ?>
  55.     <Error number="<?php echo "".$err_no?>" />
  56. </Connector>
  57.         <?php
  58.     }
  59. }
  60.  
  61. ?>

Documentation generated on Mon, 05 May 2008 16:19:14 +0400 by phpDocumentor 1.4.0